Repository navigation
Duplications detection and supplementary records - #656
Draft
NicolasBuchin wants to merge 6 commits into
Draft
NicolasBuchin wants to merge 6 commits into
NicolasBuchin wants to merge 6 commits into
Conversation
A record can be flagged as supplementary and report the SA:Z tag to cross-reference the other records.
After the best alignment has been picked, an insertion of at least --dl bases (50 by default) is realigned against the reference on both sides of the insertion point. If that beats keeping the insertion, the inserted bases are a second copy of the reference around them, so the alignment is cut into one SAM record per copy: the best scoring one primary, the rest supplementary with SA:Z tags. Adds the du:i tag in the details counting the number of duplications found on a read. Single-end only for now. --dl 0 turns detection off, and with --details du:i: reports how many insertions were re-interpreted. Is-new-baseline: yes
The two arms of a duplication stay close to the diagonal, so we bound them with --dw (20 by default) instead of filling the whole matrix. It's cheaper, and in practice it finds the true duplications better. Asking the split to score better than the insertion penalty was too simple a check on its own. Is-new-baseline: yes
A less permissive condition to consider a valid duplication, instead of beating the insertion score, the alignments needs to be at least --dm (0.80 by default) matches. Is-new-baseline: yes
NicolasBuchin
force-pushed
the
duplications
branch
from
October 16, 2026 12:19
5235dfd to
2e4ea8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces 2 things at once:
The first commit just allows reporting supplementary records, with a
SA:Ztag necessary for most SV callers to understand which records belong together once a SAM file is compressed into a BAM file. There is no use to make this it's own PR until we need supplementary records, which is why it comes with this PR for duplciations.The other commits propose a duplication detection. It works as a post-alignment step: we find the primary alignment, and before being reported it's cigar is parsed by
reinterpret_insertionswhich searches for insertion events larger than--dl(default 50), and attempts to reinterpret them as duplications.To count as a duplication they must pass a threshold of

--dm(default 0.80) matches on the query region. The reinterpretation is done by aligning the query against the 2 sides of the reference surrounding the insertion point. After that if the duplication passes the threshold, we report it by splitting the primary into 2 segments, for which we need supplementary record support. Note that this means the 2 segments have 0 read overlap/gap, which gives us base level precise breakpoints on the read and reference. This figures shows how the Insertion region is aligned against the 2 reference regions to resolve a duplication.I might refactor it into a struct and a new file